
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
    <title>功能</title>
    <style>
        /*页面内边距*/

        .addwrap {
            padding: 30px 100px 30px 100px;
        }


        /*下拉框高度*/

        .addwrap .layui-input,
        .layui-select {
            height: 25px;
        }


        /*表单左边文本样式*/

        .addwrap .layui-form-label {
            padding: 0;
            text-align: left;
            height: 26px;
            line-height: 26px;
            width: 70px;
        }


        /*下拉框子项样式*/

        .addwrap .layui-form-select dl {
            top: 26px;
            padding: 0;
        }


        /*下拉框子项内容高度*/

        .addwrap .layui-form-select dl dd,
        .layui-form-select dl dt {
            line-height: 24px;
        }

        .addwrap .layui-input-block {
            min-height: 26px;
            margin-left: 35px;
            margin-left: 0;
        }

        .height26 .layui-input-block {
            width: 200px;
        }


        /*复选框外边距*/

        .layui-form-item .layui-form-checkbox[lay-skin=primary] {
            margin-top: 0;
            margin-left: 64px;
        }


        /*多行文本框样式*/

        .layui-textarea {
            min-height: 50px;
        }

        .height26 .layui-form-item {
            height: 26px;
        }
        .tophead .layui-form-select .layui-edge {
            border-width: 4px;
        }

        /*必填红色星号样式*/

        .layui-form-mid {
            line-height: normal!important;
        }
    </style>
</head>
<body>
<div class="layui-form" lay-filter="form" >

    <input type="hidden" name="id" id="id" class="layui-input" th:value="${data.id}">


    <input type="hidden" name="sql" id="sql" class="layui-input" th:value="${data.sql}">
    <div class="addwrap">

        <div class="flex flex-jusity-betreen flex-align-center height26 ">
            <div class="layui-form-item flex">
                <label class="layui-form-label">类型</label>
                <div class="layui-input-block marginleft10">
                    <select name="lx" id="lx" th:value="${data.lx}" lay-filter="lx" required  lay-verify="required">
                        <option th:selected="${c.code == data.lx }" th:each="c : ${ftlist}" th:value="${c.code}" th:text="${c.label}">
                        </option>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>
        <div class="flex flex-align-center flex-jusity-betreen height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">功能名称</label>
                <div class="layui-input-block marginleft10">
                    <!--验证 required lay-verify="required"-->
                    <input type="text" name="mc" id="mc" th:value="${data.mc}" placeholder="请输入功能名称" autocomplete="off" class="layui-input"  required  lay-verify="required">

                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
            <div class="layui-form-item flex">
                <label class="layui-form-label">功能代码</label>
                <div class="layui-input-block marginleft10">
                    <!--验证 required lay-verify="required"-->
                    <input type="text" name="dm" id="dm" th:value="${data.dm}" placeholder="请输入功能代码" autocomplete="off" class="layui-input" required  lay-verify="required">

                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>
        <div class="flex flex-jusity-betreen flex-align-center height26">
            <div class="layui-form-item flex">
                <label class="layui-form-label">业务分类</label>
                <div class="layui-input-block marginleft10">
                    <select name="mainid" id="mainid"  th:value="${data.mainid}" lay-filter="mainid" required  lay-verify="required">
                        <option th:selected="${c.code == data.mainid }" th:each="c : ${mainList}" th:value="${c.code}" th:text="${c.label}">
                        </option>
                    </select>


                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
            <div class="layui-form-item flex">
                <label class="layui-form-label">存储过程</label>
                <div class="layui-input-block marginleft10">

                    <select name="isprocedure" id="isprocedure" style="width:79px;margin-left: 23px;" required  lay-verify="required">
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>

                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>
        <div class="flex flex-jusity-betreen flex-align-center height26">

            <div class="layui-form-item flex">
                <label class="layui-form-label">SQL模式</label>
                <div class="layui-input-block marginleft10">
                    <select name="sqltype" id="sqltype" style="width:60px" required  lay-verify="required">
                        <option value="replaceconcat">替换拼接</option>
                        <option value="nameprecompile">名称预编译</option>
                        <option value="precompile">预编译</option>
                    </select>
                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>

            <div class="layui-form-item flex">
                <label class="layui-form-label">结果类型</label>
                <div class="layui-input-block marginleft10">
                    <select name="datalx" id="datalx"  lay-filter="datalx" required  lay-verify="required">

                        <option  th:each="c : ${frtlist}" th:value="${c.code}" th:text="${c.label}">

                        </option>
                    </select>

                </div>
                <div class="layui-form-mid layui-word-aux colorred">*</div>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <div class="marginbottom10">备注</div>
            <div class="layui-input-block">
                <textarea name="bz" id="bz" placeholder="请输入备注" class="layui-textarea">[(${data.bz})]</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="save">保存</button>
            </div>
        </div>

    </div>
</div>
</body>
<script>
    $(function(){
        initEvent();
    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }
    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        $("#lx option[value='[(${data.lx})]']").attr("selected", "selected");
        $("#datalx option[value='[(${data.datalx})]']").attr("selected", "selected");
        $("#isprocedure option[value='[(${data.isprocedure})]']").attr("selected", "selected");

        $("#sqltype option[value='[(${data.sqltype})]']").attr("selected", "selected");
        if(dlCommon.getUrlParam("mainid")){
            $("#mainid option[value='"+dlCommon.getUrlParam("mainid")+"']").attr("selected", "selected");
        }

        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');

        dlCommon.post("/DevtApiSubEntityController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.getFunData();
                closeWin();
            })
        },true)
    }
</script>

</html>